package com.ccx.demo.Vo;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public class ResultService<T> extends Result{
    @Autowired
    private PageMapper pageMapper;

    public Result OK(T t){
        Result<Object> res = new Result<>();
        res.setData(t);
        res.setCode(200);
        res.setMessage("成功");
        return res;
    }
    public Result FAIL(){
        Result<Object> res = new Result<>();
        res.setCode(405);
        res.setMessage("失败");
        return res;
    }
    public Result PAGE(int page, int limit){
        int pages=(page-1)*limit;
        List<Sys> list = pageMapper.QueryPage(pages, limit);
        Result<Object> objectResult = new Result<>();
        objectResult.setData(list);
        objectResult.setCode(200);
        objectResult.setMessage("查询成功");
        return objectResult;
    }
}
